home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0080_Keyboard lights.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  1KB  |  52 lines

  1. {
  2.  ER> Anyway, Does anyone knows who to make the num/caps/scroll leds on the
  3.  ER> keyboard 'flicker' or just light up?
  4. }
  5.  
  6. PROGRAM FlashLED;
  7.  
  8. USES DOS, Crt;
  9.  
  10. CONST
  11.   LOCKSOFF = $8F;  { Mask off all LEDs }
  12.   SCRLOCK  = 16;
  13.   NUMLOCK  = 32;
  14.   CAPLOCK  = 64;
  15.  
  16. VAR
  17.   KeyLocks  : BYTE ABSOLUTE $0040:$0017;  { LED bits at this FAR address }
  18.   SaveLock  : BYTE;                       { Used to save LED status bits }
  19.  
  20. { To make DOS cause LED update }
  21. PROCEDURE DummyDosCall; ASSEMBLER;
  22. asm
  23.   mov ah, 11
  24.   int $21
  25. End;
  26.  
  27. VAR
  28.   Shift : BYTE;                    { Used in bit shifting of LEDs }
  29.  
  30. BEGIN
  31.   { Store current state }
  32.   SaveLock := KeyLocks;
  33.   Shift    := 1;
  34.  
  35.   Repeat
  36.     { Turn on the LED bit according to Shift }
  37.     KeyLocks := (SCRLOCK SHL Shift);
  38.  
  39.     { Set Shift to indicate the LED to the right }
  40.     Shift := (Shift + 1) MOD 3;
  41.  
  42.     { Allow DOS to update the LEDs }
  43.     DummyDosCall;
  44.  
  45.     { Simple pause }
  46.     Delay( 200 );
  47.   Until KeyPressed;
  48.  
  49.   { Restore original keyboard state }
  50.   KeyLocks := SaveLock;
  51. END.
  52.